import re

str1 = """ip route 192.168.1.0 255.255.255.0 10.0.0.1
ip route 192.168.2.0 255.255.255.0 10.0.0.2"""

def parser_route():
    for route in str1.split('/n'):
        if re.match('^ip route (\d{1,3}\.){3}\d{1,3} (\d{1,3}\.){3}\d{1,3} (\d{1,3}\.){3}\d{1,3}.*', route):
            print(route.rstrip())

if __name__ == '__main__':
    parser_route()